package com.ljfiction.book.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ljfiction.book.activitys.MyApication;
import com.ljfiction.book.tools.Tool;

import org.xutils.x;


public class BaseFragment extends Fragment {


    private boolean injected = false;



    @Override

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        injected = true;

        return x.view().inject(this, inflater, container);

    }



    @Override

    public void onViewCreated(View view, Bundle savedInstanceState) {

        super.onViewCreated(view, savedInstanceState);

        if (!injected) {
            x.view().inject(this, this.getView());
        }

    }

    public void showToast(String msg) {
        Tool.showToast(msg, getContext());
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
       // MyApication.mRefWatcher.watch(this);
        System.gc();
        System.runFinalization();
        System.gc();
    }
}
